/*******************************************************************************
 *  Project: libopencad
 *  Purpose: OpenSource CAD formats support library
 *  Author: Dmitry Baryshnikov, bishop.dev@gmail.com
 *  Language: C++
 *******************************************************************************
 *  The MIT License (MIT)
 *
 *  Copyright (c) 2016 NextGIS, <info@nextgis.com>
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the "Software"), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 *
 *  The above copyright notice and this permission notice shall be included in all
 *  copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 *  SOFTWARE.
 *******************************************************************************/
 #include "cadcolors.h"

const RGBColor CADACIColors[]
{
    { 0,   0,   0 },
    { 255, 0,   0 },
    { 255, 255, 0 },
    { 0,   255, 0 },
    { 0,   255, 255 },
    { 0,   0,   255 },
    { 255, 0,   255 },
    { 255, 255, 255 },
    { 65,  65,  65 },
    { 128, 128, 128 },
    { 255, 0,   0 },
    { 255, 170, 170 },
    { 189, 0,   0 },
    { 189, 126, 126 },
    { 129, 0,   0 },
    { 129, 86,  86 },
    { 104, 0,   0 },
    { 104, 69,  69 },
    { 79,  0,   0 },
    { 79,  53,  53 },
    { 255, 63,  0 },
    { 255, 191, 170 },
    { 189, 46,  0 },
    { 189, 141, 126 },
    { 129, 31,  0 },
    { 129, 96,  86 },
    { 104, 25,  0 },
    { 104, 78,  69 },
    { 79,  19,  0 },
    { 79,  59,  53 },
    { 255, 127, 0 },
    { 255, 212, 170 },
    { 189, 94,  0 },
    { 189, 157, 126 },
    { 129, 64,  0 },
    { 129, 107, 86 },
    { 104, 52,  0 },
    { 104, 86,  69 },
    { 79,  39,  0 },
    { 79,  66,  53 },
    { 255, 191, 0 },
    { 255, 234, 170 },
    { 189, 141, 0 },
    { 189, 173, 126 },
    { 129, 96,  0 },
    { 129, 118, 86 },
    { 104, 78,  0 },
    { 104, 95,  69 },
    { 79,  59,  0 },
    { 79,  73,  53 },
    { 255, 255, 0 },
    { 255, 255, 170 },
    { 189, 189, 0 },
    { 189, 189, 126 },
    { 129, 129, 0 },
    { 129, 129, 86 },
    { 104, 104, 0 },
    { 104, 104, 69 },
    { 79,  79,  0 },
    { 79,  79,  53 },
    { 191, 255, 0 },
    { 234, 255, 170 },
    { 141, 189, 0 },
    { 173, 189, 126 },
    { 96,  129, 0 },
    { 118, 129, 86 },
    { 78,  104, 0 },
    { 95,  104, 69 },
    { 59,  79,  0 },
    { 73,  79,  53 },
    { 127, 255, 0 },
    { 212, 255, 170 },
    { 94,  189, 0 },
    { 157, 189, 126 },
    { 64,  129, 0 },
    { 107, 129, 86 },
    { 52,  104, 0 },
    { 86,  104, 69 },
    { 39,  79,  0 },
    { 66,  79,  53 },
    { 63,  255, 0 },
    { 191, 255, 170 },
    { 46,  189, 0 },
    { 141, 189, 126 },
    { 31,  129, 0 },
    { 96,  129, 86 },
    { 25,  104, 0 },
    { 78,  104, 69 },
    { 19,  79,  0 },
    { 59,  79,  53 },
    { 0,   255, 0 },
    { 170, 255, 170 },
    { 0,   189, 0 },
    { 126, 189, 126 },
    { 0,   129, 0 },
    { 86,  129, 86 },
    { 0,   104, 0 },
    { 69,  104, 69 },
    { 0,   79,  0 },
    { 53,  79,  53 },
    { 0,   255, 63 },
    { 170, 255, 191 },
    { 0,   189, 46 },
    { 126, 189, 141 },
    { 0,   129, 31 },
    { 86,  129, 96 },
    { 0,   104, 25 },
    { 69,  104, 78 },
    { 0,   79,  19 },
    { 53,  79,  59 },
    { 0,   255, 127 },
    { 170, 255, 212 },
    { 0,   189, 94 },
    { 126, 189, 157 },
    { 0,   129, 64 },
    { 86,  129, 107 },
    { 0,   104, 52 },
    { 69,  104, 86 },
    { 0,   79,  39 },
    { 53,  79,  66 },
    { 0,   255, 191 },
    { 170, 255, 234 },
    { 0,   189, 141 },
    { 126, 189, 173 },
    { 0,   129, 96 },
    { 86,  129, 118 },
    { 0,   104, 78 },
    { 69,  104, 95 },
    { 0,   79,  59 },
    { 53,  79,  73 },
    { 0,   255, 255 },
    { 170, 255, 255 },
    { 0,   189, 189 },
    { 126, 189, 189 },
    { 0,   129, 129 },
    { 86,  129, 129 },
    { 0,   104, 104 },
    { 69,  104, 104 },
    { 0,   79,  79 },
    { 53,  79,  79 },
    { 0,   191, 255 },
    { 170, 234, 255 },
    { 0,   141, 189 },
    { 126, 173, 189 },
    { 0,   96,  129 },
    { 86,  118, 129 },
    { 0,   78,  104 },
    { 69,  95,  104 },
    { 0,   59,  79 },
    { 53,  73,  79 },
    { 0,   127, 255 },
    { 170, 212, 255 },
    { 0,   94,  189 },
    { 126, 157, 189 },
    { 0,   64,  129 },
    { 86,  107, 129 },
    { 0,   52,  104 },
    { 69,  86,  104 },
    { 0,   39,  79 },
    { 53,  66,  79 },
    { 0,   63,  255 },
    { 170, 191, 255 },
    { 0,   46,  189 },
    { 126, 141, 189 },
    { 0,   31,  129 },
    { 86,  96,  129 },
    { 0,   25,  104 },
    { 69,  78,  104 },
    { 0,   19,  79 },
    { 53,  59,  79 },
    { 0,   0,   255 },
    { 170, 170, 255 },
    { 0,   0,   189 },
    { 126, 126, 189 },
    { 0,   0,   129 },
    { 86,  86,  129 },
    { 0,   0,   104 },
    { 69,  69,  104 },
    { 0,   0,   79 },
    { 53,  53,  79 },
    { 63,  0,   255 },
    { 191, 170, 255 },
    { 46,  0,   189 },
    { 141, 126, 189 },
    { 31,  0,   129 },
    { 96,  86,  129 },
    { 25,  0,   104 },
    { 78,  69,  104 },
    { 19,  0,   79 },
    { 59,  53,  79 },
    { 127, 0,   255 },
    { 212, 170, 255 },
    { 94,  0,   189 },
    { 157, 126, 189 },
    { 64,  0,   129 },
    { 107, 86,  129 },
    { 52,  0,   104 },
    { 86,  69,  104 },
    { 39,  0,   79 },
    { 66,  53,  79 },
    { 191, 0,   255 },
    { 234, 170, 255 },
    { 141, 0,   189 },
    { 173, 126, 189 },
    { 96,  0,   129 },
    { 118, 86,  129 },
    { 78,  0,   104 },
    { 95,  69,  104 },
    { 59,  0,   79 },
    { 73,  53,  79 },
    { 255, 0,   255 },
    { 255, 170, 255 },
    { 189, 0,   189 },
    { 189, 126, 189 },
    { 129, 0,   129 },
    { 129, 86,  129 },
    { 104, 0,   104 },
    { 104, 69,  104 },
    { 79,  0,   79 },
    { 79,  53,  79 },
    { 255, 0,   191 },
    { 255, 170, 234 },
    { 189, 0,   141 },
    { 189, 126, 173 },
    { 129, 0,   96 },
    { 129, 86,  118 },
    { 104, 0,   78 },
    { 104, 69,  95 },
    { 79,  0,   59 },
    { 79,  53,  73 },
    { 255, 0,   127 },
    { 255, 170, 212 },
    { 189, 0,   94 },
    { 189, 126, 157 },
    { 129, 0,   64 },
    { 129, 86,  107 },
    { 104, 0,   52 },
    { 104, 69,  86 },
    { 79,  0,   39 },
    { 79,  53,  66 },
    { 255, 0,   63 },
    { 255, 170, 191 },
    { 189, 0,   46 },
    { 189, 126, 141 },
    { 129, 0,   31 },
    { 129, 86,  96 },
    { 104, 0,   25 },
    { 104, 69,  78 },
    { 79,  0,   19 },
    { 79,  53,  59 },
    { 51,  51,  51 },
    { 80,  80,  80 },
    { 105, 105, 105 },
    { 130, 130, 130 },
    { 190, 190, 190 },
    { 255, 255, 255 }
};

const RGBColor getCADACIColor(short index)
{
    if(index < 0 || index > 255)
        return {255, 255, 255};
    return CADACIColors[index];
}
